using System.Collections;
using System.Collections.Generic;
using System.Net.Mime;
using UnityEngine;
using UnityEngine.UI;

public class dead : MonoBehaviour
{
    public Player player;
    public Text text;
    void Start()
    {
     player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();   
    }

    // Update is called once per frame
    void Update()
    {
        if (player.stats.health <= 0)
        {
            OnExitClicked();
            text.text = "未完待续";
        }
        
        
        
    }
    public void OnExitClicked()
    {
        // 此方法将在按钮点击时调用
        Debug.Log("退出游戏"); // 在控制台输出信息，可以用于调试
        Application.Quit(); // 退出游戏
#if UNITY_EDITOR
        UnityEditor.EditorApplication.isPlaying = false; // 在编辑器中停止播放
#endif
    }
    
}
